<?php
  include("includes/conf.inc.php");
  include("includes/function.php");
  session_start();
  if (isset($_SESSION['usr']))
  {
    $sender = $_SESSION['usr'];
  }
  else
  {
    $sender = "Guest";
  }
  if (isset($_POST['imgID']) && isset($_POST['comment']))
  {
  $imgID = $_POST['imgID'];
  $comment = $_POST['comment'];
  
  DBConnect();
  
  $query = "INSERT INTO $discuz_tbl VALUES(NULL, '$imgID', '$sender', '$comment')";
  mysql_query($query);
  header("Location:view.php?imgID=".$imgID);
  }
  else
  {
    header("Location:index.php");
  }
?>